{extend name="default/base/base_seller" /}
{block name="seller_main"}
<div class="dssc-oredr-show">
    <div class="dssc-order-info">
        <div class="dssc-order-details">
            <div class="title">{$Think.lang.store_show_order_info}</div>
            <div class="content">
                <dl>
                    <dt>{$Think.lang.store_show_order_receiver|raw}{$Think.lang.ds_colon}</dt>
                    <dd>{$order_info['extend_order_common']['reciver_name']}&nbsp; {$order_info['extend_order_common']['reciver_info']['phone']}&nbsp; {$order_info['extend_order_common']['reciver_info']['address']}&nbsp; {$order_info['extend_order_common']['reciver_info']['house_number']}</dd>
                </dl>
                <dl>
                    <dt>{$Think.lang.invoice_spaces|raw}：</dt>
                    <dd>
                        {foreach name="$order_info['extend_order_common']['invoice_info']" item="value" key="key" }
                        <span>{$key} (<strong>{$value}</strong>)</span><br/>
                        {/foreach}
                    </dd>
                </dl>
                <dl>
                    <dt>{$Think.lang.store_show_order_buyer_message}{$Think.lang.ds_colon}</dt>
                    <dd>{$order_info['extend_order_common']['order_message']}</dd>
                </dl>
                <dl class="line">
                    <dt>{$Think.lang.store_order_order_sn}{$Think.lang.ds_colon}</dt>
                    <dd>{$order_info.order_sn}<a href="javascript:void(0);">{$Think.lang.store_more}<i class="iconfont">&#xe689;</i>
                            <div class="more"><span class="arrow"></span>
                                <ul>
                                    {if $order_info.payment_name}
                                    <li>{$Think.lang.store_order_pay_method}{$Think.lang.ds_colon}<span>{$order_info.payment_name}
                                            <?php if(!in_array($order_info['order_state'],array(ORDER_STATE_CANCEL,ORDER_STATE_NEW))) { ?>
                                            ({$Think.lang.payment_order}{$Think.lang.ds_colon}{$order_info.pay_sn})
                                            <?php } ?>
                                        </span></li>
                                    {/if}
                                    {if $order_info.o2o_distributor_id}
                                    <li>{$Think.lang.seller_order_distributor_info|raw}{$Think.lang.ds_colon}<span>{$order_info.o2o_distributor_realname}({$order_info.o2o_distributor_phone})</span></li>
                                    {/if}
                                    <li>{$Think.lang.store_order_add_time}{$Think.lang.ds_colon}<span>{$order_info.add_time|date="Y-m-d H:i:s"}</span></li>
                                    {if intval($order_info['payment_time'])}
                                    <li>{$Think.lang.store_show_order_pay_time}{$Think.lang.ds_colon}<span>{$order_info.payment_time|date="Y-m-d H:i:s"}</span></li>
                                    {/if}
                                    {if $order_info['o2o_order_pickup_time']}
                                    <li>{$Think.lang.store_show_order_send_time}{$Think.lang.ds_colon}<span>{$order_info['o2o_order_pickup_time']|date="Y-m-d H:i:s"}</span></li>
                                    {/if}
                                    {if intval($order_info['finnshed_time'])}
                                    <li>{$Think.lang.store_show_order_finish_time}{$Think.lang.ds_colon}<span>{$order_info.finnshed_time|date="Y-m-d H:i:s"}</span></li>
                                    {/if}
                                </ul>
                            </div>
                        </a></dd>
                </dl>
                <dl>
                    <dt></dt>
                    <dd></dd>
                </dl>
            </div>
        </div>
        {if $order_info['order_state'] == ORDER_STATE_CANCEL}
        <div class="dssc-order-condition">
            <dl>
                <dt><i class="iconfont orange">&#xe764;</i>{$Think.lang.store_order_state}：</dt>
                <dd>{$Think.lang.trading_closed}</dd>
            </dl>
        </div>
        {/if}
        {if $order_info['order_state'] == ORDER_STATE_NEW}
        <div class="dssc-order-condition">
            <dl>
                <dt><i class="iconfont green">&#xe64d;</i>{$Think.lang.store_order_state}：</dt>
                <dd>{$Think.lang.waiting_payment}</dd>
            </dl>
            <ul>
                <li>{$Think.lang.order_payment_steps1}</li>
                <li>{$Think.lang.order_payment_steps2}
                    <time>{$order_info.order_cancel_day|date="Y-m-d H:i:s"}</time>
                    {$Think.lang.order_payment_steps3}</li>
            </ul>
        </div>
        {/if}
        {if $order_info['order_state'] == ORDER_STATE_PAY}
        <div class="dssc-order-condition">
            <dl>
                <dt><i class="iconfont green">&#xe64d;</i>{$Think.lang.store_order_state}：</dt>
                <dd>
                    {$Think.lang.order_payment_steps5}
                </dd>
            </dl>
            <ul>
                <li>{$Think.lang.successful_ordering_tips3}{:get_order_payment_name($order_info['payment_code'])}{$Think.lang.successful_ordering_tips4}{$order_info.pay_sn}”。</li>
                <li>{$Think.lang.successful_ordering_tips5}</li>
            </ul>
        </div>
        {/if}
        {if $order_info['order_state'] == ORDER_STATE_SEND}
        <div class="dssc-order-condition">
            <dl>
                <dt><i class="iconfont green">&#xe64d;</i>{$Think.lang.store_order_state}：</dt>
                <dd>{$Think.lang.successful_ordering_tips6}</dd>
            </dl>
            <ul>
                <li>{$Think.lang.successful_ordering_tips7}

                    {:sprintf($Think.lang.successful_ordering_tips11,$order_info.o2o_distributor_name)}

                </li>

            </ul>
        </div>
        {/if}
        {if $order_info['order_state'] == ORDER_STATE_SUCCESS}
        {if $order_info['evaluation_state'] == 1}
        <div class="dssc-order-condition">
            <dl>
                <dt><i class="iconfont green">&#xe64d;</i>{$Think.lang.store_order_state}：</dt>
                <dd>{$Think.lang.successful_ordering_tips14}</dd>
            </dl>
            <ul>
                <li>{$Think.lang.successful_ordering_tips15}</li>
                <li>{$Think.lang.successful_ordering_tips16}<a href="{:url('Sellerevaluate/index')}" class="dssc-btn-mini">{$Think.lang.successful_ordering_tips17}</a>{$Think.lang.successful_ordering_tips18}</li>
            </ul>
        </div>
        {elseif $order_info['refund_state'] != 0}
        <div class="dssc-order-condition">
            <dl>
                <dt><i class="iconfont green">&#xe64d;</i>{$Think.lang.store_order_state}：</dt>
                <dd>{$Think.lang.sellerorder_have_refund}</dd>
            </dl>
            <ul>
                <li>{$Think.lang.sellerorder_have_refund_tips_1}</li>
                <li>{$Think.lang.sellerorder_have_refund_tips_2}</li>
            </ul>
        </div>
        {else/}
        <div class="dssc-order-condition">
            <dl>
                <dt><i class="iconfont green">&#xe64d;</i>{$Think.lang.store_order_state}：</dt>
                <dd>{$Think.lang.successful_ordering_tips19}</dd>
            </dl>
            <ul>
                <li>{$Think.lang.transaction_closing_tips1}</li>
                <li>{$Think.lang.transaction_closing_tips2}</li>
            </ul>
        </div>
        {/if}
        {/if}
    </div>
    {if $order_info['order_state'] != ORDER_STATE_CANCEL}
    <div id="order-step" class="dssc-order-step">
        <dl class="step-first {if $order_info['order_state'] != ORDER_STATE_CANCEL}current{/if}">
            <dt>{$Think.lang.order_submission}</dt>
            <dd class="bg"></dd>
            <dd class="date" title="">{$Think.lang.store_order_add_time}{$order_info.add_time|date="Y-m-d H:i:s"}</dd>
        </dl>
        <dl class="{if intval($order_info['payment_time'])}current{/if}">
            <dt>{$Think.lang.sellerorder_pay_order}</dt>
            <dd class="bg"> </dd>
            <dd class="date" title="{$Think.lang.store_show_order_pay_time}">{$order_info.payment_time|date="Y-m-d H:i:s"}</dd>
        </dl>
        <dl class="{if $order_info.o2o_order_pickup_time}current{/if}">
            <dt>{$Think.lang.merchant_delivery}</dt>
            <dd class="bg"> </dd>
            <dd class="date" title="{$Think.lang.o2o_order_pickup_time}">{$order_info['o2o_order_pickup_time']|date="Y-m-d H:i:s"}</dd>
        </dl>
        <dl class="{if intval($order_info['finnshed_time'])}current{/if}">
            <dt>{$Think.lang.confirmation_receipt}</dt>
            <dd class="bg"> </dd>
            <dd class="date" title="{$Think.lang.store_show_order_finish_time}">{$order_info.finnshed_time|date="Y-m-d H:i:s"}</dd>
        </dl>
        <dl class="{if $order_info['evaluation_state'] == 1}current{/if}">
            <dt>{$Think.lang.evaluation}</dt>
            <dd class="bg"></dd>
            <dd class="date" title="{$Think.lang.store_show_order_finish_time}">{$order_info.extend_order_common.evaluation_time|date="Y-m-d H:i:s"}</dd>
        </dl>
    </div>
    {/if}
    <div class="dssc-order-contnet">
        <table class="dssc-default-table order">
            <thead>
                <tr>
                    <th class="w10">&nbsp;</th>
                    <th colspan="2">{$Think.lang.store_show_order_goods_name}</th>
                    <th class="w120">{$Think.lang.store_show_order_price}</th>
                    <th class="w60">{$Think.lang.store_show_order_amount}</th>
                    <th class="w100">{$Think.lang.concessionary_activities}</th>
                    <th class=""><strong>{$Think.lang.commission_payable}</strong></th>
                    <th>{$Think.lang.store_trading_operations}</th>
                </tr>
            </thead>
            <tbody>

                <?php $i = 0;?>
                <?php foreach($order_info['goods_list'] as $k => $goods) { ?>
                <?php $i++;?>
                <tr class="bd-line">
                    <td>&nbsp;</td>
                    <td class="w50"><div class="pic-thumb"><a target="_blank" href="{$goods.goods_url}"><img src="{:goods_thumb($goods,240)}" /></a></div></td>
                    <td class="tl">
                        <dl class="goods-name">
                            <dt><a target="_blank" href="{$goods.goods_url}">{$goods.goods_name}</a></dt>
                            <dd>
                                <?php if (isset($goods['extend_order_goods_refund'])) {?>
                                <?php if($goods['extend_order_goods_refund']['refund_type'] == 1) {?>
                                 {$Think.lang.refund_number}：<a target="_blank" href="{:url('Sellerrefund/view',['refund_id'=>$goods.extend_order_goods_refund.refund_id])}">{$goods['extend_order_goods_refund']['refund_sn']}</a></dd>
                            <?php }else if($goods['extend_order_goods_refund']['refund_type'] == 2) {?>
                            {$Think.lang.return_number}：<a target="_blank" href="{:url('Sellerreturn/view',['return_id'=>$goods.extend_order_goods_refund.refund_id])}">{$goods['extend_order_goods_refund']['refund_sn']}</a>
                            <?php } ?>
                            <?php } ?>
                            </dd>
                        </dl>
                    </td>
                    <td>{$goods.goods_price}
                        <p class="green">
                            {if isset($goods['extend_order_goods_refund']) && $goods['extend_order_goods_refund']['refundreturn_admin_time'] > 0}
                            退款:{$goods.extend_order_goods_refund.refund_amount}
                            {/if}
                        </p></td>
                    <td>{$goods.goods_num}</td>
                    <td>{$goods.goods_type_cn}</td>
                    <td class="commis bdl bdr">
                        {if $goods.commis_rate != 200}
                        {$goods.goods_pay_price} * {$goods.commis_rate}% = <b>{:ds_price_format($goods['goods_pay_price']*$goods['commis_rate']/100)}</b>
                        {/if}
                    </td>

                    <!-- S 合并TD -->
                    {if (($order_info['goods_count'] > 1 && $k ==0) || ($order_info['goods_count'] == 1))}
                    <td class="bdl bdr" rowspan="{$order_info.goods_count}">{$order_info.state_desc|raw}
                        {if $order_info.if_order_refund_lock}
                        <p>{$Think.lang.refund_return_goods}</p>
                        {/if}

                        <!-- 修改价格 -->
                        {if $order_info.if_modify_price}
                        <p><a href="javascript:void(0)" class="dssc-btn" uri="{:url('Sellerorder/change_state',['state_type'=>'modify_price','order_sn'=>$order_info.order_sn,'order_id'=>$order_info.order_id])}" dialog_width="480" dialog_title="{$Think.lang.store_order_modify_price}" ds_type="dialog"  dialog_id="seller_order_adjust_fee" id="order.`{$order_info.order_id}_action_adjust_fee" />{$Think.lang.modify_freight}</a></p>
                        {/if}

                        <!-- 取消订单 -->
                        {if $order_info.if_cancel}
                        <p><a href="javascript:void(0)" style="color:#F30; text-decoration:underline;" ds_type="dialog" uri="{:url('Sellerorder/change_state',['state_type'=>'order_cancel','order_sn'=>$order_info.order_sn,'order_id'=>$order_info.order_id])}" dialog_title="{$Think.lang.store_order_cancel_order}" dialog_id="seller_order_cancel_order" dialog_width="400" id="order{$order_info.order_id}_action_cancel" />{$Think.lang.store_order_cancel_order}</a></p>
                        {/if}

                        <!-- 取货 -->
                        {if $order_info.if_pickup}
                        <p><a href="javascript:void(0)" class="dssc-btn" dstype="btn_pickup_order" />{$Think.lang.seller_order_pickup_order}</a></p>
                        {/if}
                    </td>
                    {/if}
                    <!-- E 合并TD -->
                </tr>

                <!-- S 赠品列表 -->
                {if (!empty($order_info['zengpin_list']) && $i == count($order_info['goods_list']))}
                <tr class="bd-line">
                    <td>&nbsp;</td>
                    <td colspan="6" class="tl">
                        <div class="dssc-goods-gift">{$Think.lang.store_order_gifts}：
                            <ul>
                                {foreach name="$order_info.zengpin_list" item="zengpin_info" }
                                <li><a title="{$Think.lang.store_order_gifts}：{$zengpin_info.goods_name} * {$zengpin_info.goods_num}" target="_blank" href="{$zengpin_info.goods_url}"><img src="{:goods_thumb($zengpin_info,240)}" /></a></li>
                                {/foreach}
                            </ul>
                        </div>
                    </td>
                </tr>
                {/if}
                <!-- E 赠品列表 -->

                <?php } ?>
            </tbody>
            <tfoot>
                {if (!empty($order_info['extend_order_common']['promotion_info']) || !empty($order_info['extend_order_common']['voucher_code']))}
                <tr>
                    <td colspan="20"><dl class="dssc-store-sales">
                            <dt>{$Think.lang.other_information}{$Think.lang.ds_colon}</dt>
                            {if (!empty($order_info['extend_order_common']['promotion_info']))}
                            <dd>{$order_info.extend_order_common.promotion_info|raw}</dd>
                            {/if}
                            {if (!empty($order_info['extend_order_common']['voucher_code']))}
                            <dd>{$Think.lang.used_denomination} {$order_info.extend_order_common.voucher_price} {$Think.lang.voucher_code}{$order_info.extend_order_common.voucher_code}</span></dd>
                            {/if}
                        </dl></td>
                </tr>
                {/if}
                <tr>
                    <td colspan="20"><dl class="freight">
                            <dd>
                                {if (!empty($order_info['shipping_fee']) && $order_info['shipping_fee'] != '0.00')}
                                {$Think.lang.store_show_order_tp_fee}: <span>{$Think.lang.currency|raw}{$order_info.shipping_fee}</span>
                                {else/}
                                {$Think.lang.ds_common_shipping_free}
                                {/if}
                                {if ($order_info['refund_amount'] > 0)}
                                ({$Think.lang.store_order_refund}:{$Think.lang.currency|raw}{$order_info.refund_amount})
                                {/if}
                            </dd>
                        </dl>
                        <dl class="sum">
                            <dt>{$Think.lang.store_order_sum}{$Think.lang.ds_colon}</dt>
                            <dd><em>{$order_info.order_amount}</em>{$Think.lang.ds_yuan}</dd>
                        </dl></td>
                </tr>
            </tfoot>
        </table>
    </div>
    <div class="dssc-orderlog mt15" style="border: 1px solid #DDD;padding: 15px;color: #666;">
        {foreach name="$order_info.extend_orderlog" item="orderlog" }
        <dl style="line-height: 30px;">
            {$orderlog.log_role} {$orderlog.log_user} {$orderlog.log_time|date="Y-m-d H:i:s"}&emsp;{$orderlog.log_msg}
        </dl>
        {/foreach}
    </div>    
    
</div>
<form id="pickup_form" method="post" action="{:url('Sellerorder/pickup_order')}">
    <input id="pickup_order_id" name="order_id" value="{$order_info.order_id}" type="hidden" />
</form>

<script type="text/javascript">
    $(function () {
    {if $order_info.if_pickup}

            $('[dstype="btn_pickup_order"]').on('click', function() {

    layer.confirm('{$Think.lang.seller_order_pickup_confirm}', {
    btn: ['确定', '取消'],
            title: false,
    }, function () {
    var _form = $("#pickup_form");
    $.ajax({
    type: "POST",
            url: _form.attr('action'),
            data: _form.serialize(),
            dataType:"json",
            success: function (res) {
            if (res.code == 10000) {
   
            
            layer.msg(res.message, {time: 1000}, function () {
            location.href = '{:url('Sellerorder/index')}';
            });
            } else{
            layer.msg(res.message)
            }
            }
    });
    });
    });
    {/if}

    });
</script>

{/block}
